Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamically detecting changes when .gitignore is updated #6962

Closed

Conversation

sat0yu
Copy link

@sat0yu sat0yu commented Sep 11, 2018

Summary

Test plan

followed this scenario #5730 (comment)

Sure, here's an example: https://github.com/nevir/jest-sourcemap-gitignore

Steps to repro:

  1. Run tsc --watch (and keep it running)
  2. Run jest --watch
  3. Edit foo.test.ts, and observe that jest notices the file change, but doesn't run any tests
  4. Remove *.js from .gitignore
  5. Edit foo.test.ts again, and observe that jest runs the test

(I don't think this is a bug; pretty sure it's a feature request)

jest

@sat0yu sat0yu changed the title Support dynamically detection for gitignore Support dynamically detecting changes when .gitignore is updated Sep 11, 2018
@sat0yu sat0yu force-pushed the support-dynamically-detection-for-gitignore branch from d6b6e5f to 5779d91 Compare September 11, 2018 23:42
@sat0yu sat0yu force-pushed the support-dynamically-detection-for-gitignore branch from 9b7f562 to 6242aaa Compare September 12, 2018 02:58
@codecov-io
Copy link

codecov-io commented Sep 12, 2018

Codecov Report

Merging #6962 into master will decrease coverage by 1.1%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6962      +/-   ##
==========================================
- Coverage   67.99%   66.89%   -1.11%     
==========================================
  Files         248      250       +2     
  Lines        9490    10437     +947     
  Branches        6        4       -2     
==========================================
+ Hits         6453     6982     +529     
- Misses       3035     3454     +419     
+ Partials        2        1       -1
Impacted Files Coverage Δ
packages/jest-haste-map/src/index.js 87.5% <100%> (-6.07%) ⬇️
packages/jest-cli/src/testResultHelpers.js 9.37% <0%> (-63.36%) ⬇️
packages/jest-validate/src/errors.js 54.54% <0%> (-45.46%) ⬇️
packages/jest-validate/src/warnings.js 54.54% <0%> (-45.46%) ⬇️
packages/jest-runtime/src/helpers.js 50% <0%> (-40.48%) ⬇️
packages/jest-cli/src/TestScheduler.js 44.27% <0%> (-28.46%) ⬇️
packages/jest-runner/src/index.js 47.82% <0%> (-27.79%) ⬇️
packages/jest-each/src/index.js 77.77% <0%> (-22.23%) ⬇️
packages/jest-config/src/Deprecated.js 45.45% <0%> (-21.22%) ⬇️
packages/jest-docblock/src/index.js 80% <0%> (-20%) ⬇️
... and 279 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 103f068...d0f3661. Read the comment docs.

CHANGELOG.md Outdated Show resolved Hide resolved
docs/Configuration.md Outdated Show resolved Hide resolved
@SimenB
Copy link
Member

SimenB commented Sep 12, 2018

@sat0yu I still think I'd prefer just support the ignore files of the 2 VCS-es we support. See https://fishshell.com/docs/current/design.html (Configurability is the root of all evil). I can't really think of any cases where this config would be needed for other use cases?

@sat0yu sat0yu force-pushed the support-dynamically-detection-for-gitignore branch from 8790d0b to a9054a5 Compare September 22, 2018 08:00
@thymikee
Copy link
Collaborator

Yep, I'm with @SimenB on that. We support 2 VCS so we can "hardcode" their ignore files so it's transparent to the user.

@sat0yu
Copy link
Author

sat0yu commented Sep 22, 2018

@thymikee how about this change? 235344b

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Wonder if that affects performance anyhow. Also a test would be great to add. And a changleog :)

@thymikee
Copy link
Collaborator

@sat0yu mind resolving conflicts?
@SimenB have more thoughts on this change?

@SimenB
Copy link
Member

SimenB commented Dec 19, 2018

Would love to see a test, but the code lgtm :)

@SimenB
Copy link
Member

SimenB commented Dec 19, 2018

@rickhanlonii, since you use this in RN

@SimenB
Copy link
Member

SimenB commented Dec 24, 2018

@sat0yu could you update the changelog and resolve the conflict?

let changeQueue = Promise.resolve();
let eventsQueue = [];
// We only need to copy the entire haste map once on every "frame".
let mustCopy = true;

const createWatcher = root => {
const watcher = new Watcher(root, {
dot: false,
glob: extensions.map(extension => '**/*.' + extension),
dot: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this impact all dotfiles not just .gitignore and .hgignore?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so because the line !suffixes.some(suffix => filePath.endsWith(suffix)) filters other dotfiles

@sat0yu
Copy link
Author

sat0yu commented Jan 4, 2019

@SimenB @thymikee @rickhanlonii thanks for your comments and sorry for the late response.

This PR still has a few failures in the following 2 Test Suites.
And I have not been able to fix them yet.
Could you give me some advice to resolve them?

  • packages/jest-haste-map/src/__tests __/index.test.js
    • could not include .gitignore (and .hgignore) in cases using sane
  • packages/jest-cli/src/__tests __/SearchSource.test.js
    • exclude all dot directories (e.g. .hiddenFolder) against my expectation

@SimenB
Copy link
Member

SimenB commented Jul 31, 2020

@sat0yu hey, sorry about not responding for a year and a half 😬 I got a notification for this PR for some reason just now.

Jest 26.2 includes #10075 which adds support for dotfiles (aka hidden files). So I think this can be closed now?

@sat0yu sat0yu closed this Aug 2, 2020
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants